package com.txsj.scan.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.txsj.scan.R;
import com.txsj.scan.bean.EpcGoodsInfo;

import java.util.ArrayList;
import java.util.List;

public class ReadLabelAdapter extends RecyclerView.Adapter<ReadLabelAdapter.ReadlabelViewHolder> {

    private List<EpcGoodsInfo> list;
    private Context context;

    public ReadLabelAdapter(Context context) {
        this.context = context;
        list = new ArrayList<>();
    }

    public void setList(List<EpcGoodsInfo> list) {
        this.list = list;
    }

    @Override
    public ReadlabelViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ReadlabelViewHolder(LayoutInflater.from(context).inflate(R.layout.item_read_label,parent,false));
    }

    @Override
    public void onBindViewHolder(ReadlabelViewHolder holder, int position) {
        //todo 将服务器返回的数据进行 bind
        holder.bind(position);
    }

    @Override
    public int getItemCount() {
        return (null!=list && list.size()>0)?list.size():0;
    }


    public class ReadlabelViewHolder extends RecyclerView.ViewHolder{
        TextView tv_name,tv_count;

        public ReadlabelViewHolder(View itemView) {
            super(itemView);
            tv_count = (TextView) itemView.findViewById(R.id.tv_count);
            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
        }

        public void bind(int position) {

        }
    }
}
